package me.tuyou.rmi.java;

import me.tuyou.rmi.java.service.MyService;

import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

/**
 * @Description
 * @Author tuyou_cd
 * @Date 2020/6/19 15:39
 */
public class RMIClientApp {

    public static void main(String[] args) throws RemoteException, NotBoundException {
        Registry registry = LocateRegistry.getRegistry("localhost");

        MyService myService = (MyService) registry.lookup("myService");

        System.out.println(myService.add(5, 6));
        System.out.println(myService.sub(10, 9));
    }
}
